package cn.org.book.shop.utils;

/**
 * APP 常量类
 *
 * @auther: wanghongjie
 * @blame: wanghongjie
 * @date: 2020-12-05 21:23
 * @Description:
 */
public class AppConstant {
    /**
     * 获取sessionKey
     */
    public static final String URL_GET_SESSION_KEY = "https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code";


    /**
     * appID
     */
    public static final String APP_ID = "APPID";

    public static final String SESSION_KEY = "session_key";
    public static final String UNIONID = "unionid";
    public static final String OPENID = "openid";

    /**
     * 获取sessionKey 请求URL
     *
     * @param appId  appID
     * @param secret 密钥
     * @param code   临时变量
     * @return
     */
    public static String getUrlGetSessionKey(String appId, String secret, String code) {
        return AppConstant.URL_GET_SESSION_KEY.replace(AppConstant.APP_ID, appId).replace("SECRET", secret).replace("JSCODE", code);
    }
}
